package com.dljd.javase.t13;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;

public class GetWeather {
    public static void main(String[] args) {
                try {
                    URL url=new URL("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName?theCityName=%E6%AD%A6%E6%B1%89");
                    URLConnection connection=url.openConnection();

                    InputStream in= connection.getInputStream();

                    BufferedReader reader=new BufferedReader(new InputStreamReader(in));
                    String message=null;
                    while((message=reader.readLine())!=null){
                        System.out.println(message);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }finally {

                }
            }
}
